feat(quota): resolve coding-plan usage windows via the monitor plane - #57
Merged
Merged
Conversation
Mirror the official desktop panel's two-plane split in the quota snapshot:
- credits plane (existing): zcode-plan billing/balance + preview with the
plan JWT — start-plan/trial credit buckets;
- coding plane (new): GET {api.z.ai|open.bigmodel.cn}/api/monitor/usage/
quota/limit with the raw coding-plan API key in `authorization` (bundle
wK/Z_ + md) — data.level + data.limits[] windowed usage rows, surfaced
as a Coding group in the TUI card and in the `quota` CLI / GET /quota.
Behavior fixes from the PR #56 audit:
- a credential without a plan JWT no longer kills the snapshot — credits
plane degrades to a noted error while the coding plane still resolves
(the card no longer tells logged-in users they are not logged in);
- coding rows render `remaining` only: live data shows upstream `number`
is not a comparable total (TIME_LIMIT remaining=3894 / number=1), and
the official panel likewise never renders X/Y for these windows;
- envelope success semantics mirror the bundle $_ (success !== false and
code absent/0/200); monitor failures degrade to codingPlan=null the way
the official fetchQuota().catch(() => null) does;
- non-token unitType on balance rows is now visible instead of dropped;
- empty-everything state reworded ("no quota entries reported by
upstream").
@see _reverse/NOTEPAD.md "coding-plan 用量平面"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Mirror the official desktop panel's two-plane split in the quota snapshot:
authorization(bundle wK/Z_ + md) — data.level + data.limits[] windowed usage rows, surfaced as a Coding group in the TUI card and in thequotaCLI / GET /quota.Behavior fixes from the PR #56 audit:
remainingonly: live data shows upstreamnumberis not a comparable total (TIME_LIMIT remaining=3894 / number=1), and the official panel likewise never renders X/Y for these windows;see _reverse/NOTEPAD.md "coding-plan 用量平面"